/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedbean.SOP;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;
import merlion.common.util.exception.NotExistException;
import merlion.crm.slcm.entity.Address;
import merlion.crm.slcm.entity.SalesLead;
import merlion.crm.slcm.session.SLCSessionBeanLocal;

/**
 *
 * @author Hong
 */
@ManagedBean(name = "sslManagerBean")
@SessionScoped
public class SearchSalesLeadManagerBean {
    
    @EJB
    private SLCSessionBeanLocal sLCSessionBean; 
    private List<SalesLead> salesLeads;
    private SalesLead salesLead;
    private SelectItem[] categoryOptions;
    private final static String[] categories;
    
    static{
        categories = new String[2];
        categories[0] = "WholeSale";
        categories[1] = "DirectSale";
    }
    /** Creates a new instance of SearchCustomerManagerBean */
    public SearchSalesLeadManagerBean() {
        salesLeads = new ArrayList<SalesLead>();
    }
    
     private SelectItem[] createFilterOptions(String[] data)  {  
        SelectItem[] options = new SelectItem[data.length + 1];  
  
        options[0] = new SelectItem("", "Select");  
        for(int i = 0; i < data.length; i++) {  
            options[i + 1] = new SelectItem(data[i], data[i]);  
        }  
  
        return options;  
    }

    public SelectItem[] getCategoryOptions() {
	    categoryOptions = createFilterOptions(categories);
        return categoryOptions;
    }

    public void setCategoryOptions(SelectItem[] categoryOptions) {
        this.categoryOptions = categoryOptions;
    }


    public SLCSessionBeanLocal getsLCSessionBean() {
        return sLCSessionBean;
    }

    public void setsLCSessionBean(SLCSessionBeanLocal sLCSessionBean) {
        this.sLCSessionBean = sLCSessionBean;
    }

    /**
     * @return the salesLead
     */
    public List<SalesLead> getSalesLeads() {
        salesLeads = sLCSessionBean.getAllClient();
        return salesLeads;
    }
    
    /**
     * @param salesLead the salesLead to set
     */
    public void setSalesLeads(List<SalesLead> salesLeads) {
        this.salesLeads = salesLeads;
    }


}
